package com.example.springboot10.controller;


import org.springframework.web.bind.annotation.*;

/**
 * @RestController(value = "/api")
 * 相当于
 * @Controller(value = "/api")
 * 并且在每个方法上加上注解
 * @ResponseBody
 *
 * @PostMapping 经常用于新增数据
 * @DeleteMapping 经常用于删除数据
 * @PutMapping 用于修改数据
 * @GetMapping 用于查询数据
 */
@RestController
@RequestMapping(value = "/api")
public class ApiController {




    @RequestMapping(value = "/onlyPost00",method = RequestMethod.POST)
    public Object onlyPost00(){
        return  "only Post00";
    }

    @PostMapping(value = "/onlyPost01")
    public Object onlyPost01(){
        return  "only Post01";
    }

    @RequestMapping(value = "/onlyDelete00",method = RequestMethod.DELETE)
    public Object onlyDelete00(){
        return  "only Delete00";
    }

    @DeleteMapping(value = "/onlyDelete01")
    public Object onlyDelete01(){
        return  "only Delete01";
    }

    @RequestMapping(value = "/onlyPut00",method = RequestMethod.PUT)
    public Object onlyPut00(){
        return  "only Put00";
    }
    @PutMapping(value = "/onlyPut01")
    public Object onlyPut01(){
        return  "only Put01";
    }

    @RequestMapping(value = "/onlyGet00",method = RequestMethod.GET)
    public Object onlyGet00(){
        return  "only Get200";
    }

    @GetMapping(value = "/onlyGet01")
    public Object onlyGet01(){
        return  "only Get01";
    }

}
